package top.lshaci.learning.framework.swagger.model;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.util.Objects;

@Data
public class Field {
    String name;
    String type;
    String format;
    boolean require;
    Boolean ref;
    String description;

    public String getRequire() {
        return require ? "true" : "false";
    }

    public Boolean getRef() {
        return Objects.equals(ref, Boolean.TRUE);
    }

    public String getType() {
        return StrUtil.isNotBlank(type) ? type : "object";
    }
}
